<template>
  <div id="app">
    <transition :name="transitionName">  
      <router-view class="child-view"></router-view>  
    </transition>  
  </div>
</template>

<script>
export default {
  name: "bread_recognition",
  data() {
    return {
      transitionName: "slide-left",
      isShowStartPage: true
    };
  },
  watch: {
    $route(to, from) {
      if (to.path == "/") {
        this.transitionName = "slide-right";
      } else {
        this.transitionName = "slide-left";
      }
    }
  },
};
</script>

<style scoped>
#app {
  font-family: "微软雅黑";
  -webkit-app-region: drag;
  -webkit-user-select: none;
  width: 100%;
  height: 100%;
  overflow: hidden;
}
.child-view {
  position: absolute;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  transition: all 0.5s cubic-bezier(0.55, 0, 0.1, 1);
}
.slide-left-enter,
.slide-right-leave-active {
  opacity: 0;
  -webkit-transform: translate(30px, 0);
  transform: translate(30px, 0);
}
.slide-left-leave-active,
.slide-right-enter {
  opacity: 0;
  -webkit-transform: translate(-30px, 0);
  transform: translate(-30px, 0);
}
.fade-enter-active,
.fade-leave-active {
  transition: opacity 2s;
}
.fade-enter,
.fade-leave-to {
  opacity: 0;
}
</style>